home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / sqrt.s < prev    next >
Text File  |  1991-09-24  |  752b  |  43 lines

  1. # pml compatible lib for the atari sfp004
  2. #
  3. # Michael Ritzert, Oktober 1990
  4. # ritzert@dfg.dbp.de
  5. #
  6. # FUNCTION:    SQRT(X)
  7. #
  8. # base =    0xfffa50
  9. #      the fpu addresses are taken relativ to "base":
  10. comm =     -6
  11. resp =    -16
  12. zahl =      0
  13.  
  14.     .even
  15. LC0:
  16.     .ascii "sqrt: DOMAIN error\12\15\0"
  17.     .even
  18. .text
  19.     .even
  20. .globl _sqrt
  21. _sqrt:
  22.     tstl    a7@(4)
  23.     bpl    continue
  24.     moveml    d0-d7/a0-a6,a7@-
  25.     pea    LC0
  26.     movew    #9,a7@-
  27.     trap    #1
  28.     addql    #6,a7
  29.     moveml    a7@+,d0-d7/a0-a6
  30. #                    | continue to get the NAN
  31. continue:
  32.     lea    0xfffa50,a0
  33.     movew    #0x5404,a0@(comm)    | specify function
  34.     cmpiw    #0x8900,a0@(resp)    | check
  35.     movel    a7@(4),a0@        | load arg_hi
  36.     movel    a7@(8),a0@        | load arg_low
  37.     movew    #0x7400,a0@(comm)    | result to d0
  38. # wait
  39.     .long    0x0c688900, 0xfff067f8
  40.     movel    a0@,d0
  41.     movel    a0@,d1
  42.     rts
  43.